home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / disp182a.zip / DRVSRC / ACUMOS.ASM next >
Assembly Source File  |  1994-02-23  |  14KB  |  382 lines

  1. ;--------------------------------------------------------------------------
  2. ; This is file ACUMOS.ASM
  3. ;
  4. ; Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  5. ; Copyright (C) 1992 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
  6. ; Copyright (C) 1993 Hartmut Schirmer, Feldstr. 118, 2300 Kiel 1, Germany
  7. ; Copyright (C) 1993 Matthias Burian, Imhoffg. 6, 2232 Strasshof, Austria
  8. ;
  9. ; This file is distributed under the terms listed in the document
  10. ; "copying.dj", available from DJ Delorie at the address above.
  11. ; A copy of "copying.dj" should accompany this file; if not, a copy
  12. ; should be available from where this file was obtained.  This file
  13. ; may not be distributed without a verbatim copy of "copying.dj".
  14. ;
  15. ; This file is distributed WITHOUT ANY WARRANTY; without even the implied
  16. ; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. ;--------------------------------------------------------------------------
  18. ;
  19. ; This is the graphics driver for AcuMos AVGA2 chipsets
  20. ; It has been derived from Hartmut Schirmers CIRRUS54.GRN
  21. ; and the STDVGA.GRN graphics driver by Csaba Biegl/DJ Delorie
  22. ;
  23.     .386
  24. include grdriver.inc
  25. cseg    segment use16 byte public 'code'
  26.     assume  cs:cseg, ds:cseg, es:cseg, ss:nothing
  27.  
  28.  
  29. ;--------------------------------------------------------------------------
  30. ; DRIVER HEADER
  31. ;  The following entries MUST match the structure and constant
  32. ;  declarations in the file 'grdriver.h' of the GRX graphics library
  33. ;  The mode word should contain the following bitfields:
  34. ;     - the GRD_NEW_DRIVER bit set for any new format driver
  35. ;     - the adapter type field should be specified
  36. ;     - the memory size field should be specified
  37. ;     - the paging mode field should be specified
  38. ;  The mode set routine will OR in the plane bitfield as it will
  39. ;  change when different color number modes are requested.
  40. ;--------------------------------------------------------------------------
  41.  
  42.     dw      offset mode_set_routine
  43.     dw      offset paging_routine
  44. mode_W  dw      GRD_NEW_DRIVER+GRD_VGA+GRD_1024K+GRD_NO_RW
  45. ;
  46. ; The 'def_xx' fields are filled in by go32 from the corresponding
  47. ; fields of the 'GO32' environment variable
  48. ;
  49. def_tw  dw      80              ; text width
  50. def_th  dw      25              ; text height
  51. def_gw  dw      640             ; graphics width
  52. def_gh  dw      480             ; graphics height
  53. def_nc  dw      16              ; graphics colors
  54.     dw      offset driver_init_routine
  55.     dw      offset text_mode_table
  56.     dw      offset graphics_mode_table
  57.  
  58. ;
  59. ; Biggest text and graphics sizes
  60. ;
  61. Max_TW  equ     132
  62. Max_TH  equ     50
  63. Max_GWn equ     800             ; non interlaced!!!
  64. Max_GHn equ     600
  65. Max_GW  equ     1024            ; may be interlaced
  66. Max_GH  equ     768
  67.  
  68.  
  69. ;--------------------------------------------------------------------------
  70. ; TABLE OF SUPPORTED TEXT MODES
  71. ;       - keep sorted by size
  72. ;       - end with an all 0 entry
  73. ;       - BIOS field = 0xff disables it
  74. ;       - fields:
  75. ;               width,  height, colors, BIOS#+  setup_procedure_index*256
  76. ;--------------------------------------------------------------------------
  77. text_mode_table         label word
  78.     dw      80,     25,     2,      007h +  00000h
  79.     dw      40,     25,     16,     001h +  00000h
  80.     dw      80,     25,     16,     003h +  00000h
  81.     dw      80,     50,     16,     003h +  00100h
  82.     dw      132,    25,     16,     055h +  00000h
  83.     dw      132,    43,     16,     054h +  00000h
  84.     dw      0,      0,      0,      000h +  00000h
  85.  
  86.  
  87. ;--------------------------------------------------------------------------
  88. ; TABLE OF SUPPORTED GRAPHICS MODES
  89. ;       - keep sorted first by colors then by size
  90. ;       - end with an all 0 entry
  91. ;       - BIOS field = 0xff disables it
  92. ;       - fields:
  93. ;               width,  height, colors, BIOS#+  setup_procedure_index*256
  94. ;--------------------------------------------------------------------------
  95. graphics_mode_table     label word
  96.     dw      320,    200,    16,     00dh +  00000h
  97.     dw      640,    200,    16,     00eh +  00000h
  98.     dw      640,    350,    16,     010h +  00000h
  99.     dw      640,    480,    16,     012h +  00000h
  100.     dw      800,    600,    16,     058h +  00000h
  101.     dw      1024,   768,    16,     05dh +  00000h
  102.     dw      320,    200,    256,    013h +  00000h
  103.     dw      640,    480,    256,    05fh +  00000h
  104.     dw      800,    600,    256,    05ch +  00000h
  105.     dw      0,        0,      0,    000h +  00000h
  106.  
  107. ; The AcuMos AVGA2 SVGA card supports two 'native' VESA modes,
  108. ; 640x480x256 colors. They can be accessed by the 'standard extended' modes,
  109. ; so I omitted VESA support
  110. ;
  111. ;--------------------------------------------------------------------------
  112. ; TABLE OF SPECIAL SETUP PROCEDURES
  113. ;  You may need such procedures for:
  114. ;     -- reloading fonts on standard EGA or VGA for
  115. ;        higher resolution text modes
  116. ;     -- enable HiColor mode of some Super VGAs
  117. ;     -- Handle the parameter passing conventions of the VESA BIOS
  118. ;     -- put VGA into 256 color plane mode ("MODE X")
  119. ;     -- etc...
  120. ;  There should be one entry in the table for every non-zero
  121. ;  'setup_procedure_index' in the text and graphics mode tables.
  122. ;  The first entry in the table belongs to index 100h, and so on.
  123. ;  The special setup procedure is invoked via a near call.
  124. ;
  125. ;  Entry: DI=address of the mode record from the text or graphics
  126. ;         table to set up.
  127. ;
  128. ;  Exit:  Adapter configured
  129. ;         BX=driver mode word as it should be returned by the mode set
  130. ;            routine. Typically it involves picking up the mode word
  131. ;            from the header and OR-ing in the appropriate bitplane mode
  132. ;            bitfield. (This is not needed for text modes)
  133. ;         AX, CX, DX, SI can be trashed, PRESERVE DI!!!!
  134. ;
  135. ;  NOTE: This runs in real mode, but don't mess with the segment registers.
  136. ;--------------------------------------------------------------------------
  137. special_setup_table     label word
  138.     dw      offset  VGA_50row_mode_set
  139.  
  140. ;
  141. ; Routine to set up VGA 50 row mode
  142. ; interface is described above
  143. ;
  144. VGA_50row_mode_set      proc    near
  145.     mov     ax,03h                  ; set 80x25 mode
  146.     int     10h
  147.     xor     bx,bx
  148.     mov     ax,1112h                ; load 8x8 font
  149.     int     10h
  150.     ret
  151. VGA_50row_mode_set      endp
  152.  
  153.  
  154. ;--------------------------------------------------------------------------
  155. ; DRIVER INIT ROUTINE
  156. ;  called once after the driver is loaded
  157. ;  may do one or more of the followings:
  158. ;    - check for proper board type
  159. ;    - check amount of RAM on board, and:
  160. ;       -- update word in header to reflect correct amount
  161. ;       -- disable modes in the tables for which there is not enough RAM
  162. ;    - check for special equipment (HiColor DAC, etc...)
  163. ;
  164. ;  Entry: nothing
  165. ;
  166. ;  Exit:  AX=status:
  167. ;          non-zero: OK,
  168. ;          0: something went wrong (e.g. wrong adapter, etc..)
  169. ;         BX,CX,DX may be trashed
  170. ;
  171. ;  NOTE: This runs in real mode, but don't mess with the segment registers.
  172. ;--------------------------------------------------------------------------
  173. driver_init_routine     proc    far
  174.     mov     ax,1                    ; Really primitive, but works
  175.     ret                             ; Make sure you've an GD542X Chip !
  176. driver_init_routine     endp
  177.  
  178.  
  179. ;--------------------------------------------------------------------------
  180. ; MODE SET ROUTINE
  181. ;  sets up a text or graphics mode as close as possible to the one
  182. ;  reguested by the user with regard to number of colors and size.
  183. ;
  184. ;  Entry: AX=mode selection
  185. ;     0 = 80x25 text
  186. ;     1 = default text
  187. ;     2 = text CX cols by DX rows
  188. ;     3 = biggest text
  189. ;     4 = 320x200 graphics
  190. ;     5 = default graphics
  191. ;     6 = graphics CX width by DX height
  192. ;     7 = biggest non-interlaced graphics
  193. ;     8 = biggest graphics
  194. ;     9 = graphics BX colors, CX width by DX height
  195. ;
  196. ;  Exit: BX=driver mode flag
  197. ;        CX=width (in pixels or characters)
  198. ;        DX=height
  199. ;
  200. ;  NOTE: This runs in real mod